package com.fzj.example.basic;

/**
 * ClassName: MyFinal
 * date: 2019/10/15 11:59
 * Description: TODO
 *
 * @author fanzj@bonree.com
 * @since JDK 1.8
 */
public class MyFinal {
    private static int x=100;
    public static void main(String[] args) {
        MyFinal myFinal=new MyFinal();
        Node node=new Node(33);
        final Node nodeA=node;
        Node nodeB=nodeA;
        nodeA.c="";
        //不能nodeA.b
        node.setA(23);
        nodeB.setA(23);
        System.out.println(nodeB.equals(node));
    }
}
class Node{
    private static String b;
    public static String c;
    private int a;
    Node(int a){
        this.a=a;
    }

    public void setA(int a) {
        this.a = a;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj==null){
            return false;
        }
        if(this==obj){
            return true;
        }
        if(obj instanceof  Node){
            Node a= (Node) obj;
            if(a.a==this.a){
                return true;
            }
            return false;
        }
        return false;
    }

    @Override
    public int hashCode() {
        return new Integer(this.a).hashCode();
    }
}